<template>
	<view class="electronic-case">
		<Load :load="load" />
		<view class="card-row" v-for="cItem in cardLabel" :key='cItem.fKey'>
			<template v-if="params[cItem.key]">
				<label>{{cItem.label}}</label>{{params[cItem.key]||'daas'}}
			</template>
		</view>
		<u-empty text="暂无病例" mode="list" v-if="!params&&!load"></u-empty>
	</view>
</template>

<script>
	import Load from '@/components/Load/index.vue'
	import { getElectronicCase } from '@/api/otherService.js'
	import { mapGetters } from 'vuex'
	export default {
		components:{ Load },
		data() {
			return {
				load:false,
				params:'',
				cardLabel:[
					{
						label:'呼吸：',
						key:'br_reathe',
						fKey:'label11',
					},
					{
						label:'血压：',
						key:'br_nibp',
						fKey:'label21',
					},
					{
						label:'体温：',
						key:'br_emperature',
						fKey:'label31',
					},
					{
						label:'现病史：',
						key:'br_xbs',
						fKey:'label41',
					},
					{
						label:'既往史：',
						key:'br_jws',
						fKey:'label51',
					},
					{
						label:'主诉：',
						key:'br_zs',
						fKey:'label61',
					},
					{
						label:'家族史：',
						key:'br_jzs',
						fKey:'label71',
					},
					{
						label:'辅助检查：',
						key:'br_fzjc',
						fKey:'label81',
					},
					{
						label:'体检：',
						key:'br_tj',
						fKey:'label91',
					},
					{
						label:'流行病学史：',
						key:'br_lxbxs',
						fKey:'label52',
					},
					{
						label:'查体：',
						key:'br_ct',
						fKey:'label53',
					},
					{
						label:'处理：',
						key:'br_cl',
						fKey:'label54',
					},
					{
						label:'处理情况：',
						key:'br_clqk',
						fKey:'label55',
					},
					{
						label:'注意事项：',
						key:'br_zysx',
						fKey:'label56',
					},
					{
						label:'健康宣教：',
						key:'br_jkxj',
						fKey:'label57',
					}
				],
				ghxh:null
			}
		},
		computed:{
			...mapGetters(['userInfo'])
		},
		async onLoad(op) {
			this.ghxh = op.ghxh||null
			await this.$onLaunched
			this.initData()
		},
		methods: {
			initData(){
				if(!this.userInfo.patId){
					uni.navigateTo({
						// url:'/pages/Login/index'
						url:'/pages/Login/addPatient'
					})
					return
				}
				this.load = true
				let params = {
					ghxh: this.ghxh,
					patId:this.userInfo.patId
				}
				getElectronicCase(params).then(data => {
					this.load = false
					let res = data||[]
					if(res.length){
						this.params = res[0]
					}else{
						this.params = ''
					}
				}).catch(e => {
					this.params = ''
					this.load = false
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.electronic-case{
		height: calc(100vh);
		overflow: scroll;
		background-color: #fff;
		.card-row{
			margin: 10rpx 30rpx;
			>label{
				width: 180rpx;
			}
		}
	}
</style>
